Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickTime Components /
Chapter 12 - Preview Components


Summary of Preview Components

C Summary

Constants

enum {
   pnotComponentWantsEvents   = 1,  /* component requires events */
   pnotComponentNeedsNoCache  = 2   /* component does not require cache */
};
enum {
   kPreviewShowDataSelector            = 1,  /* PreviewShowData */
   kPreviewMakePreviewSelector         = 2,  /* PreviewMakePreview */
   kPreviewMakePreviewReferenceSelector= 3,  
                                          /* PreviewMakePreviewReference */
   kPreviewEventSelector               = 4   /* PreviewEvent */
};
#define ShowFilePreviewComponentType 'pnot'     /* creates previews */
#define CreateFilePreviewComponentType 'pmak'   /* displays previews */

Data Types

typedef ComponentInstance pnotComponent;
typedef struct pnotResource {
   unsigned long  modDate;    /* modification date */
   short          version;    /* version number of preview resource */
   OSType         resType;    /* type of resource used as preview cache */
   short          resID;      /* resource identification number
                                 of resource used as preview cache */
   short          numResItems;/* number of additional file descriptions */
   pnotResItem    resItem[ ]; /* array of file descriptions */
} pnotResource;
typedef struct pnotResItem {
   unsigned long  modDate; /* last modification date of item */
   OSType         useType; /* what type of data */
   OSType         resType; /* resource type containing item */
   short          resID;   /* resource ID containing this item */
   short          rgnCode; /* region code */
   long           reserved;/* set to 0 */
} pnotResItem; *pnotResItemPtr;

Functions

Displaying Previews

pascal ComponentResult PreviewShowData
(pnotComponent p, OSType dataType,
Handle data, const Rect *inHere);

Handling Events

pascal ComponentResult PreviewEvent
(pnotComponent p, EventRecord *e, 
Boolean *handledEvent);

Creating Previews

pascal ComponentResult PreviewMakePreview
(pnotComponent p, OSType *previewType, 
Handle *previewResult, 
const FSSpec *sourceFile, ProgressProcRecordPtr progress);
pascal ComponentResult PreviewMakePreviewReference
(pnotComponent p, OSType *previewType, 
short *resID, const FSSpec *sourceFile);

Pascal Summary

Constants

CONST
   {flags for component flags field for your preview component}
   pnotComponentWantsEvents   = 1;  {component requires events}
   pnotComponentNeedsNoCache  = 2;  {component does not require cache}
   {selectors for preview components}
   kPreviewShowDataSelector               = 1;  {PreviewShowData}
   kPreviewMakePreviewSelector            = 2;  {PreviewMakePreview}
   kPreviewMakePreviewReferenceSelector   = 3;  {PreviewMakePreviewReference}
   kPreviewEventSelector                  = 4;  {PreviewEvent}
   {component types and subtypes}
   ShowFilePreviewComponentType     'pnot'   {creates previews}
   CreateFilePreviewComponentType   'pmak'   {displays previews}

Data Types

TYPE
   pnotComponent = ComponentInstance;{preview component type}
   pnotResource =
   RECORD
      modDate:          LongInt;    {modification date}
      version:          Integer;    {version number of preview }
                                    { resource}
      resType:          OSType;     {type of resource used as preview }
                                    { cache}
      resID:            Integer;    {resource identification number }
                                    { of resource used as preview }
                                    { cache}
      numResItems:      Integer;    {number of additional file }
                                    { descriptions}
      ARRAY OF resItem[ ]: pnotResItem;
                                    {array of file descriptions}
   END;
   pnotResItem =
   RECORD
      modDate:    LongInt;    {last modification date of item}
      useType:    OSType;     {what type of data}
      resType:    OSType;     {resource type containing item}
      resID:      Integer;    {resource ID containing this item}
      rgnCode:    Integer;    {region code}
      reserved:   LongInt;    {set to 0}
   END;

Routines

Displaying Previews

FUNCTION PreviewShowData(p: pnotComponent; dataType: OSType; 
data: Handle; VAR inHere: Rect): 
ComponentResult;

Handling Events

FUNCTION PreviewEvent(p: pnotComponent; VAR e: EventRecord; 
VAR handledEvent: Boolean): ComponentResult;

Creating Previews

FUNCTION PreviewMakePreview
(p: pnotComponent; VAR previewType: OSType; 
VAR previewResult: Handle; 
VAR sourceFile: FSSpec; 
progress: ProgressProcRecordPtr): ComponentResult;
FUNCTION PreviewMakePreviewReference
(p: pnotComponent; VAR previewType: OSType; 
VAR resID: Integer; VAR sourceFile: FSSpec): ComponentResult;


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help